package com.lirh.mysql.controller;

import com.lirh.mysql.service.ProductService;
import com.lirh.mysql.vo.BuyInfoVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
public class ProductController {
    @Autowired
    private ProductService productService;


    @PostMapping("/buy")
    public Boolean buy(@RequestBody BuyInfoVo buyInfo){
        return productService.purchase(buyInfo.getUsrId(), buyInfo.getProductId(), buyInfo.getQuantity());
    }
}
